<template>
	<view>
		<view v-if="data != '' " class="list p30">
			<view @tap="GoOrderDetails(v)" v-for="(v,i) in data" :key="i" class="listBox">
				<view class="title">
					<p class="p1 one">
						{{v.content}}
					</p>
					<p class="p2">
						{{v.lastModifiedDate}}
					</p>
				</view>
				<view class="goods">
					<image :src="v.resultData.thumbnail" mode="aspectFit"></image>
					<view class="txts">
						<p class="one p1">
							{{v.resultData.productName}}
						</p>
						<p class="one p1">
							订单号：{{v.resultData.orderSn}}
						</p>
					</view>
				</view>
			</view>
			
		</view>
		<view v-if="data == '' " class=" dataNone">
			<image src="../../static/image/dongtai@2x.png" mode=""></image>
			<p>暂无消息 ~ </p>
		</view>
	</view> 
</template>

<script>
	import {
		messageList
	} from '../../api/api.js'
	export default {
		data() {
			return {
				pageNumber: 1,
				pageSize: 10,
				stops: 0,
				data: []
			}
		},
		onLoad() {
			this.init()
		},
		onReachBottom() {
			if(this.stops == 0){
				this.init()
			}
		},
		methods: {
			GoOrderDetails(v) {
				this.$navigateTo('../OrderDetails/OrderDetails?id=' + v.resultData.orderId)
			},
			async init() {
				let parameret = {
					pageable: {
						pageNumber: this.pageNumber,
						pageSize: this.pageSize
					},
					type: 'ORDER_ASSISTAN'
				}
				let data = await messageList(parameret)
				data = data.data
				if (data.length != this.pageSize) {
					this.stops = 1
				}
				this.data = [...this.data,...data]
				this.pageNumber++
			},
		}
	}
</script>

<style lang="less" scoped>
@import './index.less';
</style>
